/* 
 * Copyright 2011 kOSMik.
 * This file is part of kOSMik.
 * 
 * kOSMik is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * kOSMik is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with kOSMik.  If not, see <http://www.gnu.org/licenses/>.
 *  
 * kOSMik:
 * Open Street Map - Editor.
 * http://code.google.com/p/swp-dv-ws2010-osm-2/
 */

package de.fuberlin.kosmik.data;

/**
 * This class holds needed values from the data base schema. A correct usage of
 * the data base is exclusively over the constants of this class
 */
final class DBNames {

	private DBNames() {
		// private constructor.
	}

	/**
	 * Name of the table space.
	 */
	static final String DATABASE_NAME = "kosmik.db"; //$NON-NLS-1$

	/**
	 * Creation script.
	 */
	static final String CREATE_SCHEMA_ASSET = "createLite.sql"; //$NON-NLS-1$
	/**
	 * Current version of the database.
	 */
	static final int DATABASE_VERSION = 1;
	/**
	 * Media table.
	 */
	static final String MEDIA = "media"; //$NON-NLS-1$
	/**
	 * POI Table.
	 */
	static final String POI = "poi"; //$NON-NLS-1$
	/**
	 * Point Table.
	 */
	static final String POINT = "point"; //$NON-NLS-1$
	/**
	 * Table for associating points and ways.
	 */
	static final String POINTS_HAVE_WAYS = "points_have_ways"; //$NON-NLS-1$
	/**
	 * OSM Tags for POIs.
	 */
	static final String POI_VALUE = "poi_value"; //$NON-NLS-1$
	/**
	 * Table for tracks.
	 */
	static final String TRACK = "track"; //$NON-NLS-1$
	/**
	 * Table for ways.
	 */
	static final String WAY = "way"; //$NON-NLS-1$
	/**
	 * OSM Tags for ways.
	 */
	static final String WAY_VALUE = "way_value"; //$NON-NLS-1$

	/**
	 * Media table.
	 * 
	 */
	protected static class Media {
		/**
		 * Point to which this media belongs.
		 */
		protected static final String POINT_ID = "point_id"; //$NON-NLS-1$
		/**
		 * URI to the media.
		 */
		protected static final String CONTENT = "content"; //$NON-NLS-1$
		/**
		 * Type of the media (audio, video, etc.).
		 */
		protected static final String FORMAT = "format"; //$NON-NLS-1$
	}

	/**
	 * POI Table.
	 * 
	 */
	protected static class Poi {
		/**
		 * PK.
		 */
		protected static final String ID = "id"; //$NON-NLS-1$
		/**
		 * Association to the point.
		 */
		protected static final String POINT_ID = "point_id"; //$NON-NLS-1$
	}

	/**
	 * Point table.
	 * 
	 */
	protected static class Point {
		/**
		 * PK.
		 */
		protected static final String ID = "id"; //$NON-NLS-1$
		/**
		 * Track this point belongs to.
		 */
		protected static final String TRACK_ID = "track_id"; //$NON-NLS-1$
		/**
		 * Longitude.
		 */
		protected static final String LNG = "lng"; //$NON-NLS-1$
		/**
		 * Latitude.
		 */
		protected static final String LAT = "lat"; //$NON-NLS-1$
		/**
		 * Timestamp this point was created.
		 */
		protected static final String TIME = "time"; //$NON-NLS-1$
	}

	/**
	 * Association between points and ways.
	 * 
	 */
	protected static class PointsHaveWays {
		/**
		 * Point FK.
		 */
		protected static final String POINT_ID = "point_id"; //$NON-NLS-1$
		/**
		 * Way FK.
		 */
		protected static final String WAY_ID = "way_id"; //$NON-NLS-1$
	}

	/**
	 * OSM Tags for POIs.
	 * 
	 */
	protected static class PoiValue {
		/**
		 * Key.
		 */
		protected static final String K = "k"; //$NON-NLS-1$
		/**
		 * FK to the POI.
		 */
		protected static final String POI_ID = "poi_id"; //$NON-NLS-1$
		/**
		 * Value.
		 */
		protected static final String V = "v"; //$NON-NLS-1$
	}

	/**
	 * Table for tracks.
	 * 
	 * 
	 */
	protected static class Track {
		/**
		 * PK.
		 */
		protected static final String ID = "id"; //$NON-NLS-1$
		/**
		 * User defined name.
		 */
		protected static final String NAME = "name"; //$NON-NLS-1$
		/**
		 * Posix timestamp of creation.
		 */
		protected static final String TIME = "time"; //$NON-NLS-1$
	}

	/**
	 * Table for ways.
	 * 
	 */
	protected static class Way {
		/**
		 * PK.
		 */
		protected static final String ID = "id"; //$NON-NLS-1$
		/**
		 * Flag that indicates if the way is an area.
		 */
		protected static final String IS_AREA = "is_area"; //$NON-NLS-1$
		/**
		 * User defined name.
		 */
		protected static final String NAME = "name"; //$NON-NLS-1$
	}

	/**
	 * Table for OSM tags in ways.
	 * 
	 */
	protected static class WayValue {
		/**
		 * PK.
		 */
		protected static final String WAY_ID = "way_id"; //$NON-NLS-1$
		/**
		 * Key.
		 */
		protected static final String K = "k"; //$NON-NLS-1$
		/**
		 * Value.
		 */
		protected static final String V = "v"; //$NON-NLS-1$
	}

}
